package com.itcast.activity;

import java.util.ArrayList;
import com.itcast.R;
import com.itcast.adapter.HomeGalleryAdapter;
import com.itcast.parser.HomeParser;
import com.itcast.vo.HomeGallery;
import com.itcast.vo.RequestVo;
import android.view.View;
import android.widget.Gallery;

public class HomeActivity extends BaseActivity{
	private Gallery gallery;
	private ArrayList<HomeGallery> homeList;

	@Override
	public void onClick(View v) {
	}

	@Override
	protected void findViewById() {
		gallery = (Gallery) findViewById(R.id.gallery);
	}

	@Override
	protected void loadViewLayout() {
		setContentView(R.layout.home_activity);
	}

	@Override
	protected void processLogic() {
		RequestVo vo = new RequestVo();
		vo.requestUrl = R.string.home;
		vo.context = context;
		vo.jsonParser = new HomeParser();
		getDataFromServer(vo, new DataCallback<ArrayList<HomeGallery>>() {

			@Override
			public void processData(
					ArrayList<HomeGallery> paramObject,
					boolean paramBoolean) {
				homeList = paramObject;
				HomeGalleryAdapter adapter = new HomeGalleryAdapter(context,homeList,gallery);
				gallery.setAdapter(adapter);
			}
		});
	}
	
	
	@Override
	protected void setListener() {
	}

}
